class yolov4_cfg():
    momentum = 0.03
    eps = 1E-4

    # 顺序 index(name) in_channels,out_channels,kernel_size,stride,padding,momentum,eps
    # layertype  “conv”,"route","shortcut","upsample","yolohead","maxpool " 
    # layersp []    “conv”:[0],"route": name cat,"shortcut":name add,"upsample":上采样倍数,"yolohead":[0],"maxpool":卷积核大小
    configs = [
        # 
        [0,3,32,3,1,1,momentum,eps,"conv",[0]],
        [1,32,64,3,2,1,momentum,eps,"conv",[0]],
        [2,64,64,1,1,0,momentum,eps,"conv",[0]],
        
        [3,64,64,1,1,0,momentum,eps,"route",[1]], # route 1 
        
        [4,64,64,1,1,0,momentum,eps,"conv",[0]],
        [5,64,32,1,1,0,momentum,eps,"conv",[0]],
        [6,32,64,3,1,1,momentum,eps,"conv",[0]],
        
        [7,64,64,1,1,0,momentum,eps,"shortcut",[4,6]], # shortcut layer 4  + layer 6
           
        [8,64,64,1,1,0,momentum,eps,"conv",[0]],
        
        [9,64,128,1,1,0,momentum,eps,"route",[8,2]], # route 8 2

        [10,128,64,1,1,0,momentum,eps,"conv",[0]],
        [11,64,128,3,2,1,momentum,eps,"conv",[0]],
        [12,128,64,1,1,0,momentum,eps,"conv",[0]],

        [13,64,128,2,1,0,momentum,eps,"route",[11]], # route 11

        [14,128,64,1,1,0,momentum,eps,"conv",[0]],
        [15,64,64,1,1,0,momentum,eps,"conv",[0]],
        [16,64,64,3,1,1,momentum,eps,"conv",[0]],

        [17,64,64,1,1,0,momentum,eps,"shortcut",[14,16]],# shortcut layer 14 

        [18,64,64,1,1,0,momentum,eps,"conv",[0]],
        [19,64,64,3,1,1,momentum,eps,"conv",[0]],

        [20,64,64,1,1,0,momentum,eps,"shortcut",[17,19]],# shortcut layer 17

        [21,64,64,1,1,0,momentum,eps,"conv",[0]],

        [22,64,128,1,1,0,momentum,eps,"route",[21,12]],# route 21 12 

        [23,128,128,1,1,0,momentum,eps,"conv",[0]],
        [24,128,256,3,2,1,momentum,eps,"conv",[0]],
        [25,256,128,1,1,0,momentum,eps,"conv",[0]],

        [26,128,128,1,1,0,momentum,eps,"route",[24]],# route 24

        [27,256,128,1,1,0,momentum,eps,"conv",[0]],
        [28,128,128,1,1,0,momentum,eps,"conv",[0]],
        [29,128,128,3,1,1,momentum,eps,"conv",[0]],

        [30,128,128,1,1,0,momentum,eps,"shortcut",[27,29]],# shortcut 27

        [31,128,128,1,1,0,momentum,eps,"conv",[0]],
        [32,128,128,3,1,1,momentum,eps,"conv",[0]],

        [33,128,128,1,1,0,momentum,eps,"shortcut",[30,32]],# shortcut 30

        [34,128,128,1,1,0,momentum,eps,"conv",[0]],
        [35,128,128,3,1,1,momentum,eps,"conv",[0]],

        [36,128,128,1,1,0,momentum,eps,"shortcut",[33,35]],# shortcut 33

        [37,128,128,1,1,0,momentum,eps,"conv",[0]],
        [38,128,128,3,1,1,momentum,eps,"conv",[0]],

        [39,128,128,1,1,0,momentum,eps,"shortcut",[36,38]], # shortcut 36

        [40,128,128,1,1,0,momentum,eps,"conv",[0]],
        [41,128,128,3,1,1,momentum,eps,"conv",[0]],

        [42,128,128,1,1,0,momentum,eps,"shortcut",[39,41]], # shortcut 39

        [43,128,128,1,1,0,momentum,eps,"conv",[0]],
        [44,128,128,3,1,1,momentum,eps,"conv",[0]],

        [45,128,128,1,1,0,momentum,eps,"shortcut",[42,44]],# shortcut 42

        [46,128,128,1,1,0,momentum,eps,"conv",[0]],
        [47,128,128,3,1,1,momentum,eps,"conv",[0]],

        [48,128,128,1,1,0,momentum,eps,"shortcut",[45,47]],# shortcut 45

        [49,128,128,1,1,0,momentum,eps,"conv",[0]],
        [50,128,128,3,1,1,momentum,eps,"conv",[0]],

        [51,128,128,1,1,0,momentum,eps,"shortcut",[48,50]],# shortcut 48

        [52,128,128,1,1,0,momentum,eps,"conv",[0]],

        [53,128,256,1,1,0,momentum,eps,"route",[52,25]],# route 52 25

        [54,256,256,1,1,0,momentum,eps,"conv",[0]],
        [55,256,512,3,2,1,momentum,eps,"conv",[0]],
        [56,512,256,1,1,0,momentum,eps,"conv",[0]],

        [57,512,256,1,1,0,momentum,eps,"route",[55]], # route 55

        [58,512,256,1,1,0,momentum,eps,"conv",[0]], 
        [59,256,256,1,1,0,momentum,eps,"conv",[0]],
        [60,256,256,3,1,1,momentum,eps,"conv",[0]],

        [61,256,256,1,1,0,momentum,eps,"shortcut",[58,60]], # Shortcut Layer: 58

        [62,256,256,1,1,0,momentum,eps,"conv",[0]],
        [63,256,256,3,1,1,momentum,eps,"conv",[0]],

        [64,256,256,1,1,0,momentum,eps,"shortcut",[61,63]], # Shortcut Layer: 61

        [65,256,256,1,1,0,momentum,eps,"conv",[0]], 
        [66,256,256,3,1,1,momentum,eps,"conv",[0]],

        [67,256,256,1,1,0,momentum,eps,"shortcut",[64,66]], # Shortcut Layer: 64

        [68,256,256,1,1,0,momentum,eps,"conv",[0]],
        [69,256,256,3,1,1,momentum,eps,"conv",[0]],

        [70,256,256,1,1,0,momentum,eps,"shortcut",[67,69]], # Shortcut Layer: 67
        
        [71,256,256,1,1,0,momentum,eps,"conv",[0]],
        [72,256,256,3,1,1,momentum,eps,"conv",[0]],

        [73,256,256,1,1,0,momentum,eps,"shortcut",[70,72]], # Shortcut Layer: 70

        [74,256,256,1,1,0,momentum,eps,"conv",[0]], 
        [75,256,256,3,1,1,momentum,eps,"conv",[0]],

        [76,256,256,1,1,0,momentum,eps,"shortcut",[73,75]], # Shortcut Layer: 73

        [77,256,256,1,1,0,momentum,eps,"conv",[0]],
        [78,256,256,3,1,1,momentum,eps,"conv",[0]],

        [79,256,256,1,1,0,momentum,eps,"shortcut",[76,78]], # Shortcut Layer: 76

        [80,256,256,1,1,0,momentum,eps,"conv",[0]], 
        [81,256,256,3,1,1,momentum,eps,"conv",[0]],

        [82,256,256,1,1,0,momentum,eps,"shortcut",[79,81]], # Shortcut Layer: 79

        [83,256,256,1,1,0,momentum,eps,"conv",[0]],

        [84,256,512,1,1,0,momentum,eps,"route",[83,56]], # route 83 56

        [85,512,512,1,1,0,momentum,eps,"conv",[0]],
        [86,512,1024,3,2,1,momentum,eps,"conv",[0]],
        [87,1024,512,1,1,0,momentum,eps,"conv",[0]],

        [88,512,1024,1,1,0,momentum,eps,"route",[86]], # route 86

        [89,1024,512,1,1,0,momentum,eps,"conv",[0]],
        [90,512,512,1,1,0,momentum,eps,"conv",[0]],
        [91,512,512,3,1,1,momentum,eps,"conv",[0]],

        [92,512,512,1,1,0,momentum,eps,"shortcut",[89,91]], # Shortcut Layer: 89

        [93,512,512,1,1,0,momentum,eps,"conv",[0]],
        [94,512,512,3,1,1,momentum,eps,"conv",[0]],

        [95,512,512,1,1,0,momentum,eps,"shortcut",[92,94]], # Shortcut Layer: 92

        [96,512,512,1,1,0,momentum,eps,"conv",[0]], 
        [97,512,512,3,1,1,momentum,eps,"conv",[0]],

        [98,512,512,1,1,0,momentum,eps,"shortcut",[95,97]], # Shortcut Layer: 95

        [99,512,512,1,1,0,momentum,eps,"conv",[0]],
        [100,512,512,3,1,1,momentum,eps,"conv",[0]],

        [101,512,512,1,1,0,momentum,eps,"shortcut",[98,100]], # Shortcut Layer: 98

        [102,512,512,1,1,0,momentum,eps,"conv",[0]],

        [103,512,1024,1,1,0,momentum,eps,"route",[102,87]], # route 102 87

        [104,1024,1024,1,1,0,momentum,eps,"conv",[0]],
        [105,1024,512,1,1,0,momentum,eps,"conv",[0]],
        [106,512,1024,3,1,1,momentum,eps,"conv",[0]],
        [107,1024,512,1,1,0,momentum,eps,"conv",[0]],

        [108,512,512,5,1,0,momentum,eps,"maxpool",[5]], # maxpool 5 x 5

        [109,512,512,1,1,0,momentum,eps,"route",[107]], # route 107

        [110,512,512,9,1,0,momentum,eps,"maxpool",[9]], # maxpool  9 x 9

        [111,512,512,1,1,0,momentum,eps,"route",[107]], #route  107

        [112,512,512,13,1,0,momentum,eps,"maxpool",[13]], # maxpool 

        [113,512,2048,1,1,0,momentum,eps,"route",[112,110,108,107]], # route  112 110 108 107 

        [114,2048,512,1,1,0,momentum,eps,"conv",[0]],
        [115,512,1024,3,1,1,momentum,eps,"conv",[0]],
        [116,1024,512,1,1,0,momentum,eps,"conv",[0]],
        # 改动
        [117,512,256,1,1,0,momentum,eps,"conv",[0]],

        [118,256,256,1,1,0,momentum,eps,"upsample",[2]], # upsample  2x 

        [119,256,256,1,1,0,momentum,eps,"route",[85]], # route  85
        # 改动
        [120,512,256,1,1,0,momentum,eps,"conv",[0]],

        [121,256,512,1,1,0,momentum,eps,"route",[120,118]], # route  120 118

        [122,512,256,1,1,0,momentum,eps,"conv",[0]],   
        [123,256,512,3,1,1,momentum,eps,"conv",[0]],
        [124,512,256,3,1,1,momentum,eps,"conv",[0]],
        [125,256,512,3,1,1,momentum,eps,"conv",[0]],
        [126,512,256,1,1,0,momentum,eps,"conv",[0]],
        # 改动
        [127,256,128,1,1,0,momentum,eps,"conv",[0]],
        # [127,256,128,1,1,0,momentum,eps,"conv",[0]],

        [128,128,128,1,1,0,momentum,eps,"upsample",[2]], # upsample 2x

        [129,128,256,1,1,0,momentum,eps,"route",[54]],  # route  54 
        # 改动
        [130,256,128,1,1,0,momentum,eps,"conv",[0]],
        # [130,256,128,1,1,0,momentum,eps,"conv",[0]],

        [131,128,256,1,1,0,momentum,eps,"route",[130,128]], # route  130 128 	

        [132,256,128,1,1,0,momentum,eps,"conv",[0]],

        [133,128,256,3,1,1,momentum,eps,"conv",[0]], 
        [134,256,128,1,1,0,momentum,eps,"conv",[0]],
        [135,128,256,3,1,1,momentum,eps,"conv",[0]],
        [136,256,128,1,1,0,momentum,eps,"conv",[0]],

        #######################################
        [137,128,256,3,1,1,momentum,eps,"conv",[0]],
        [138,256,255,1,1,0,momentum,eps,"conv",[0]],
        [139,255,255,1,1,0,momentum,eps,"yolohead",[2]], # yolo head

        #######################################
        [140,256,128,1,1,0,momentum,eps,"route",[136]], #  route  136

        [141,128,256,3,2,1,momentum,eps,"conv",[0]], 

        [142,256,512,1,1,0,momentum,eps,"route",[141,126]], # route  141 126

        [143,512,256,1,1,0,momentum,eps,"conv",[0]],
        [144,256,512,3,1,1,momentum,eps,"conv",[0]],
        [145,512,256,1,1,0,momentum,eps,"conv",[0]],
        [146,256,512,3,1,1,momentum,eps,"conv",[0]],
        [147,512,256,1,1,0,momentum,eps,"conv",[0]], 

        ####################################
        [148,256,512,3,1,1,momentum,eps,"conv",[0]],
        [149,512,255,1,1,0,momentum,eps,"conv",[0]],
        [150,255,255,1,1,0,momentum,eps,"yolohead",[1]], # yolo head
        
        #######################################
        [151,512,256,1,1,0,momentum,eps,"route",[147]], # route  147 

        [152,256,512,3,2,1,momentum,eps,"conv",[0]],

        [153,512,1024,1,1,0,momentum,eps,"route",[152,116]], # route  152 116

        [154,1024,512,1,1,0,momentum,eps,"conv",[0]], 
        [155,512,1024,3,1,1,momentum,eps,"conv",[0]],
        [156,1024,512,1,1,0,momentum,eps,"conv",[0]],
        [157,512,1024,3,1,1,momentum,eps,"conv",[0]],
        [158,1024,512,1,1,0,momentum,eps,"conv",[0]],
        ########################################
        [159,512,1024,3,1,1,momentum,eps,"conv",[0]],
        [160,1024,255,1,1,0,momentum,eps,"conv",[0]],

        [161,255,255,1,1,0,momentum,eps,"yolohead",[0]] # yolo head
    ] 
